package com.gxa.employment.controller;

import com.gxa.employment.common.Result;
import com.gxa.employment.entity.dto.PageBean;
import com.gxa.employment.entity.pojo.Interview;
import com.gxa.employment.entity.vo.PageVo;
import com.gxa.employment.service.InterviewService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 模拟面试记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-03-25
 */
@RestController
@RequestMapping("/interview")
public class InterviewController {
    InterviewService interviewService;

    public InterviewController (InterviewService interviewService) {
        this.interviewService = interviewService;
    }

    //    添加模拟面试结论记录
    @PostMapping("/add")
    public Result add(@RequestBody Interview interview) {
        System.out.println("1111"+interview);
        Boolean add = interviewService.add(interview);
        if (add){
            return Result.success();
        }
      return  Result.error(500,"添加失败");
    }
//    查询模拟面试记录,分页查询a
    @PostMapping("/query")
    public Result query(@RequestBody PageBean pageBean){
        PageVo<Interview> select = interviewService.select(pageBean);
        return Result.success(select);
    }
}
